<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	  xmlns:h="http://java.sun.com/jsf/html"
	  xmlns:f="http://java.sun.com/jsf/core"
      xmlns:c="http://java.sun.com/jsp/jstl/core"
      xmlns:p="http://primefaces.org/ui">

<h:head>
	<title>Pesquisar Pessoa</title>
	<style>@IMPORT url("../estilo.css")</style>
</h:head>
<body>

	<h:form>
				
		<h:panelGrid columns="3">  
			<p:commandButton value="Pesquisar" action="#{pesquisarPessoa.pesquisar}"/>
			<p:commandButton value="Cadastrar" action="#{manterPessoa.novo}" />
			<p:commandButton value="Limpar" action="#{pesquisarPessoa.limpar}"/> 
	    </h:panelGrid>  
		
		<p:messages />
		
		<p:panel id="panelFiltro" header="Filtros" style="width:30%"> 
			
			<h:panelGrid columns="2">  
	            <h:outputText id="labelNome" value="Nome: " />
	            <p:inputText  id="nome" value="#{pesquisarPessoa.dadosFiltro.nomeCompleto}"  maxlenght="40" size="40"/>
	        </h:panelGrid>
	    </p:panel>
			
		<p:panel id="panelResultado" header="Pesquisar Pessoa" style="width:30%" > 
			<p:dataTable id="listaPessoa" var="p" value="#{pesquisarPessoa.pessoas}" >  
				<p:column><f:facet name="header">CPF</f:facet> #{p.cpfCnpj}</p:column>
				<p:column><f:facet name="header">Nome Completo</f:facet> #{p.nomeCompleto}</p:column>
				
				<p:column>
					<f:facet name="header">Editar</f:facet>
					<h:commandButton action="#{manterPessoa.editar}" id="editar" 
						image="../imagens/editar.png" >   
						<f:param name="idPessoa" value="#{p.id}" />
					</h:commandButton>
					
				</p:column>
				
				<p:column>
					<f:facet name="header">Excluir</f:facet>
					<h:commandButton action="#{pesquisarPessoa.excluir}" id="excluir" 
						image="../imagens/excluir.jpg" >   
						<f:param name="idPessoa" value="#{p.id}" />
					</h:commandButton>
				</p:column>
		    </p:dataTable>
	    </p:panel>
	</h:form>
</body>
</html>